<?php

class My_Controller extends CI_Controller {
    
    protected $_config;
    protected $_viewFront;
    protected $_staticPathPublic;
    protected $_staticFrontthemes;
    
    public function __construct() {
        parent::__construct();
        //get config
        $this->_config = $this->config->config;
        $this->_viewFront = $this->_config['front_path'];
        $this->_staticPathPublic = $this->_config['front_public'];

        // Init data
        $data = array();
        $data['imageFrontPath'] = $this->_config['base_url'] . $this->_staticPathPublic . 'images';
        //Load Section
        $this->load->model('frontend/category_model', 'Cate', TRUE);
        $result = $this->Cate->sec_GetALLCategory(NULL);
	
        $data['menu'] = $result;
        // Load library template
        $this->load->library('template');
        $this->load->library('modules');
        // Set template
        $this->template->set_template('default');

        // Parse data into view
        $this->template->parse_view('header', $this->_config['front_themes'] . 'header', $data);
        $this->template->parse_view('sidebar', $this->_config['front_themes'] . 'sidebar', $data);
        $this->template->parse_view('footer', $this->_config['front_themes'] . 'footer', $data);

        //Add js into template
        $this->template->add_js($this->_staticPathPublic . 'js/jquery.js');
        
        //Add css into template
        $this->template->add_css($this->_staticPathPublic . 'css/default.css');
    }
}
